<?php
ob_start();

function __autoload($class_name) {
include './'.$class_name . '.php';
}

	function test_input($data) {
		$data = trim($data);
		$data = stripslashes($data);
		$data = htmlspecialchars($data);
		return $data;
	}

$email = null;
$name = null;
$mobile = null;
$message = null;
	
	if ($_SERVER["REQUEST_METHOD"] == "POST") {
		if (isset($_POST['email'])){
			$email = test_input($_POST['email']);		
		}
		if (isset($_POST['name'])){
			$name = test_input($_POST['name']);		
		}
		if (isset($_POST['mobile'])){
			$mobile = test_input($_POST['mobile']);		
		}
		if (isset($_POST['message'])){
			$message = test_input($_POST['message']);		
		}
		$status=true;
	}	
	
	$dbConfig = new DBConfigNew(); 
	$conn = $dbConfig->getConnection();
	$mysqli=$conn;
	$sql = "INSERT INTO volunteer(tx_name,tx_mobile,tx_email,tx_message) values('$name','$mobile','$email','$message')";
	if ($status && $featuredproject=$mysqli->query($sql)){
	}else{
		$status=false;
	}


$sender = "contact@atleticodekolkatafans.com";
$sendMailSender = new SendMail();
$sendMailSender->setSenderAddress($sender);
$sendMailSender->setRecipientAddress($email);
$sendMailSender->setSubject("Thank You for Contacting Us");
$body="<html><body style='font-family:Verdana;'> Hello ". $name .",<br/><br/> Thank you for interest.<br/><br/> We will keep you posted about various updates from our side.<br/><br/>Thanks and Regards<br/>Atletico De Kolkata Fans Team</body></html>";
$sendMailSender->setEmailBody($body);
$sendMailSender->sendMail();


$results = array();
$results['success'] = $status;
echo json_encode($results);;
ob_end_flush();
?>
